<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
        <!-- <form action="http://localhost:8080/upload" method="post" enctype="multipart/form-data">
            <input type="file" name="f1" >
            <input type="submit" value="上传">
        </form> -->
    <input type="file" name="f1" id="file1">
    <input type="submit" value="上传" id="submit">
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    let f1=document.getElementById('file1');
    $('#submit').click(()=>{
        let formData=new FormData();
        formData.append('f1',f1.files[0]);
        $.ajax({
            type: "POST",
            url: "http://localhost:8080/upload",
            data: formData,
            processData:false,
            mimeType:"multipart/form-data",
            contentType:false,
            success: function (response) {
            }
        });
    })
</script>
</html>